$def with(user, category, rank_len, start_date)
<!DOCTYPE html>
$:render.header()

        <div class="container bs-docs-container">
            <div class="row">

                <div class="col-md-3">
                    <div class="bs-sidebar hidden-print" role="complementary">
                        <ul class="nav bs-sidenav">
                            <li>
                                <a href="#adminuser">用户管理</a>
                                <ul class="nav">
                                    <li><a href="#addsingleuser">添加单个用户</a></li>
                                    <li><a href="#addmultipleuser">批量导入用户</a></li>
                                </ul>
                            </li>
                            <li><a href="#admincategory">完成时间管理</a></li>
                            <li><a href="#editstartdate">开学时间管理</a></li>
                        </ul>
                    </div>
                </div>

                <div class="col-md-9" role="main">
                    <div class="bs-docs-section">
                        <div class="page-header">
                            <h1 id="adminuser">用户管理</h1>
                        </div>
                        <table class="table table-bordered table-hover tablesorter table-striped" id="adminusertable">
                            <thead>
                                <tr>
                                    <th>UserName</th>
                                    <th>POJName</th>
                                    <th>Grade</th>
                                    <th>Class</th>
                                    <th>Manage</th>
                                </tr>
                            </thead>
                            <tbody>
                                $for u in user:
                                    <tr>
                                    <td>$u.user_name</td>
                                    <td>$u.poj_name</td>
                                    <td>$u.grade</td>
                                    <td>$u.class1</td>
                                    $if u.permission == 1:
                                        $ status = 'Disabled'
                                    $elif u.permission == 0:
                                        $ status = 'Enable'
                                    <td><a href="#" data-toggle="modal" data-target="#edituser-$u.user_id">Edit</a> | <a href="/disabled/$u.user_id/$u.permission">$status</a></td>
                                        <dir class="modal fade" id="edituser-$u.user_id" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <form role="form" action="/edituser" method="POST">
                                                        <div class="modal-header">
                                                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                                        </div>
                                                        <br>
                                                        <p align="center" style="color:red">*留空不修改</p>
                                                        <div class="modal-body">
                                                            <div class="form-group">
                                                                <label>UserName</label>
                                                                <input type="text" class="form-control" id="editusername-$u.user_id" name="editusername-$u.user_id" value="$u.user_name">
                                                            </div>
                                                            <div class="form-group">
                                                                <label>Password</label>
                                                                <input type="password" class="form-control" id="edituserpassword-$u.user_id" name="edituserpassword-$u.user_id" value="">
                                                            </div>
                                                            <div class="form-group">
                                                                <label>POJName</label>
                                                                <input type="text" class="form-control" id="edituserpojname-$u.user_id" name="edituserpojname-$u.user_id" value="$u.poj_name">
                                                            </div>
                                                            <div class="form-group">
                                                                <label>Grade</label>
                                                                <input type="text" class="form-control" id="editusergrade-$u.user_id" name="editusergrade-$u.user_id" value="$u.grade">
                                                            </div>
                                                            <div class="form-group">
                                                                <label>Class</label>
                                                                <input type="text" class="form-control" id="edituserclass-$u.user_id" name="edituserclass-$u.user_id" value="$u.class1">
                                                            </div>
                                                            <div class="form-group">
                                                                <label>SDUTOJName</label>
                                                                <input type="text" class="form-control" id="editusersdutojname-$u.user_id" name="editusersdutojname-$u.user_id" value="$u.sdutoj_id">
                                                            </div>
                                                            <div class="form-group">
                                                                <label>HDOJName</label>
                                                                <input type="text" class="form-control" id="edituserhdojname-$u.user_id" name="edituserhdojname-$u.user_id" value="$u.hdoj_id">
                                                            </div>
                                                            <div class="form-group">
                                                                <label>CFName</label>
                                                                <input type="text" class="form-control" id="editusercfname-$u.user_id" name="editusercfname-$u.user_id" value="$u.cf_id">
                                                            </div>
                                                            <div class="form-group">
                                                                <label>TCName</label>
                                                                <input type="text" class="form-control" id="editusertcname-$u.user_id" name="editusertcname-$u.user_id" value="$u.tc_id">
                                                            </div>
                                                            <div class="form-group">
                                                                <label>BCName</label>
                                                                <input type="text" class="form-control" id="edituserbcname-$u.user_id" name="edituserbcname-$u.user_id" value="$u.bc_id">
                                                            </div>
                                                        </div>
                                                        <div class="modal-footer">
                                                            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                                            <button type="submit" class="btn btn-primary">Save changes</button>
                                                        </div>
                                                    </form>
                                                </div>
                                            </div>
                                        </dir>
                                    </tr>
                            </tbody>
                        </table>
                        <div id="addsingleuser">
                            <br>
                            <br>
                        </div>
                        <h3 id="addsingleuser">添加单个用户</h3>
                        <form action="/adduser" method="POST" role="form">
                            <div class="row">
                                <div class="form-group">
                                    <input type="text" class="form-control" id="addsingleusername-0" name="addsingleusername-0" placeholder="UserName">
                                </div>
                                <div class="form-group">
                                    <input type="text" class="form-control" id="addsingleuserpojname-0" name="addsingleuserpojname-0" placeholder="POJName">
                                </div>
                                <div class="form-group">
                                    <input type="text" class="form-control" id="addsingleusergrade-0" name="addsingleusergrade-0" placeholder="Grade">
                                </div>
                                <div class="form-group">
                                    <input type="text" class="form-control" id="addsingleuserclass-0" name="addsingleuserclass-0" placeholder="Class">
                                </div>
                                <input type="hidden" name="usernumber-999999" value="1">
                                <div class="form-group">
                                    <button type="submit" class="btn btn-default">Submit</button>
                                </div>
                            </div>
                        </form>
                        <div id="addmultipleuser">
                            <br>
                            <br>
                        </div>
                        <h3>批量导入用户</h3>
                        <form action="/uploadfile" enctype="multipart/form-data" method="POST" role="form">
                            <div class="form-group">
                                <label>用户文件</label>
                                <input type="file" id="myfile" name="myfile">
                                <p class="help-block">请上传格式为xls、xlsx文件。表格的列依次是姓名、POJ帐号、年级、班级。无需表头。</p>
                            </div>
                            <button type="submit" class="btn btn-default">上传</button>
                        </form>
                    </div>

                    <div class="bs-docs-section">
                        <div class="page-header">
                            <h1 id="admincategory">完成时间管理</h1>
                        </div>
                        <form role="form" action="/editdeadline" method="POST"> 
                            <table class="table table-bordered" id="editdeadlinetable">
                            $for cate in category:
                                <tr>
                                $if cate.cid <= rank_len[0]:
                                    $if cate.cid == 1:
                                        <td rowspan="$rank_len[0]">$cate.rank</td>
                                        <td>$cate.cname</td>
                                    $else:
                                        <td>$cate.cname</td>
                                $elif cate.cid <= rank_len[0] + rank_len[1]:
                                    $if cate.cid == rank_len[0] + 1:
                                        <td rowspan="$rank_len[1] + 1">$cate.rank</td>
                                        <td>$cate.cname</td>
                                    $else:
                                        <td>$cate.cname</td>
                                $elif cate.cid <= rank_len[0] + rank_len[1] + rank_len[2]:
                                    $if cate.cid == rank_len[0] + rank_len[1] + 1:
                                        <td rowspan="$rank_len[2]">$cate.rank</td>
                                        <td>$cate.cname</td>
                                    $else:
                                        <td>$cate.cname</td>
                                <td>
                                    <input type="text" class="date form_date form-control" data-date data-date-format="yyyy-mm-dd" id="editdeadline-$cate.cid" name="editdeadline-$cate.cid" value="$cate.deadline" readonly>
                                </td>
                                </tr>
                            </table>
                            <button type="submit" class="btn btn-default">Submit</button>
                        </form>

                    </div>

                    <div class="bs-docs-section">
                        <div class="page-header">
                            <h1 id="editstartdate">开学时间管理</h1>
                        </div>
                        <form role="form" action="editstartdate" method="POST">
                            <table class="table table-bordered" id="editstartdatetable">
                            $for sd in start_date:
                                <tr>
                                <td>$sd.start_date</td>
                                </tr>
                            </table>
                        </form>

                </div>
            </div>
        </div>





$:render.footer()
